#pragma once

#include <engine.core/XmlDomStream.hpp>
#include <engine.core/Logger.hpp>

#include "Writer.hpp"




class DatabaseXmlWriter : public DatabaseWriter
{
private:

	LoggerPtr            m_logger;

	QFile                m_file;
	QXmlStreamWriter     m_writer;
	XmlDomWriterStream   m_xmlStream;

public:

	DatabaseXmlWriter(const QString& fname, const LoggerPtr& logger);
	virtual ~DatabaseXmlWriter();



	void write(const STRICT_PTR(DatabaseItem)& item);



	/**
	 * Factory function that creates a DatabaseXmlWriter instance.
	 */
	static DatabaseWriterPtr create(const QString& fname, const LoggerPtr& logger);

private:

	void writeProperties(const Properties& properties);
};
///////////////////////////////////////////////////////////////////////////////////////////////////
